PHP

How to print the size of the empty class in PHP | PHP program

How to print the size of the empty class in PHP | PHP program

How to print the size of the empty class in PHP | PHP program

 We will define a class Student and then print the size of the object of the empty class using the sizeof() function.

<?php

class Student
{
}

$S = new Student();
echo "Size of object: " . sizeof($S);
?>
TutorialsLink Curator

This is an official account managed by the team TutorialsLink Community